raar.process
Class RAAgent

java.lang.Object
  extended byraar.world.RAWorldObject
      extended byraar.process.RAAgent
All Implemented Interfaces:
RAGVectorObjectSource
Direct Known Subclasses:
RAExternalAgent

public class RAAgent
extends RAWorldObject

Overall class that brings all the process and agent stuff together. This class allows one to fully construct an agent.


Field Summary
static java.lang.String AGENT_CLASS_NAME
           
static int SIZE
           
 
Fields inherited from class raar.world.RAWorldObject
OBJ_ELLIPSE, OBJ_RECTANGLE, rotation, SOBJ_AGENT, SOBJ_TRACE
 
Constructor Summary
RAAgent()
          Default constructor
RAAgent(java.util.Vector processes)
           
RAAgent(java.util.Vector processes, boolean makeActors)
           
 
Method Summary
 void addProcess(RAProcess p)
           
 boolean canBeExternal()
           
 boolean canBeSimulated()
           
 void connect(RAProcess outputProcess, java.lang.String outputProcessRegister, RAProcess inputProcess, java.lang.String inputProcessRegister)
          Connect a specified output to a specified input.
 RAGVectorObject createGVectorObject()
          Create a GVectorObject.
 void disconnect(RAProcess outputProcess, java.lang.String outputProcessRegister, RAProcess inputProcess, java.lang.String inputProcessRegister)
          Disconnect a specified input from a specified output.
 void dump()
          Dump all registers of all processes.
 RAActor getAngleActor()
           
 java.awt.Color getColor()
          Return the colour this object should be drawn in.
 java.util.Vector getConnections()
           
 java.lang.String getName()
           
 java.util.Vector getNormalProcesses()
          Allows one to get only the normal processes.
 java.util.Vector getOtherProcesses()
          Get the non-normal processes...
 RAProcess getProcess(java.lang.String na)
          Return the process with given name.
 java.util.Vector getProcesses()
          Return the compiled processes.
 RAActor getSpeedActor()
           
 RAActor getTraceActor()
           
 RAWorld getWorld()
          Return the world the agent is in.
 boolean isConnected()
           
 boolean isEditable()
           
 boolean needsConnection()
           
 void notifyAddedToWorld(RAWorld r, java.awt.geom.Point2D.Double originalPosition, double originalRotation)
          Notify this agent that it has been added to the specified world -- from now on it can request this world to move it.
 void removeProcess(RAProcess p)
           
 void replaceProcess(RAProcess p, RAProcess newP)
          Replace process p by newP.
 void reset()
          Reset the agent.
 void runAgent()
          Runs the agent once.
 void setName(java.lang.String s)
           
 void setRotation(double rotation)
           
 java.lang.String toString()
           
 
Methods inherited from class raar.world.RAWorldObject
getBounds, getClassName, getPosition, getRotation, getType, moveBy, setPosition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AGENT_CLASS_NAME

public static final java.lang.String AGENT_CLASS_NAME
See Also:
Constant Field Values

SIZE

public static final int SIZE
See Also:
Constant Field Values
Constructor Detail

RAAgent

public RAAgent()
Default constructor


RAAgent

public RAAgent(java.util.Vector processes)

RAAgent

public RAAgent(java.util.Vector processes,
               boolean makeActors)
Method Detail

setRotation

public void setRotation(double rotation)

setName

public void setName(java.lang.String s)

getName

public java.lang.String getName()

isEditable

public boolean isEditable()

getSpeedActor

public RAActor getSpeedActor()

getAngleActor

public RAActor getAngleActor()

getTraceActor

public RAActor getTraceActor()

getColor

public java.awt.Color getColor()
Description copied from class: RAWorldObject
Return the colour this object should be drawn in.

Specified by:
getColor in interface RAGVectorObjectSource
Overrides:
getColor in class RAWorldObject

addProcess

public void addProcess(RAProcess p)
                throws RAException
Throws:
RAException

removeProcess

public void removeProcess(RAProcess p)
                   throws RAException
Throws:
RAException

replaceProcess

public void replaceProcess(RAProcess p,
                           RAProcess newP)
                    throws RAException
Replace process p by newP. Connections from and to p that newP supports will be kept intact. Specify null for newP to actually just remove p and all connections from and to p.

Throws:
RAException

connect

public void connect(RAProcess outputProcess,
                    java.lang.String outputProcessRegister,
                    RAProcess inputProcess,
                    java.lang.String inputProcessRegister)
             throws RAException
Connect a specified output to a specified input. Will except if the processes do not exist in the agent, the registers do not exist in the processes, or if one of the arguments is null.

Throws:
RAException

disconnect

public void disconnect(RAProcess outputProcess,
                       java.lang.String outputProcessRegister,
                       RAProcess inputProcess,
                       java.lang.String inputProcessRegister)
Disconnect a specified input from a specified output.
This will be done by removing the RAPair from the connections list.


getConnections

public java.util.Vector getConnections()

notifyAddedToWorld

public void notifyAddedToWorld(RAWorld r,
                               java.awt.geom.Point2D.Double originalPosition,
                               double originalRotation)
Notify this agent that it has been added to the specified world -- from now on it can request this world to move it.


getWorld

public RAWorld getWorld()
Return the world the agent is in.


reset

public void reset()
           throws RAException
Reset the agent.

Throws:
RAException

runAgent

public void runAgent()
              throws RAException
Runs the agent once. All processes will be executed parallelly, and data will be sent. After one of these runs, the agents becomes read-only to protect internal integrity. You then must reset the agent before you can edit any content.

Throws:
RAException

getProcesses

public java.util.Vector getProcesses()
Return the compiled processes.


getProcess

public RAProcess getProcess(java.lang.String na)
Return the process with given name.


dump

public void dump()
Dump all registers of all processes.


getNormalProcesses

public java.util.Vector getNormalProcesses()
Allows one to get only the normal processes. So actors, s ensor nor inhibit/surpress are allowed.

Returns:
vector with all normal processes

getOtherProcesses

public java.util.Vector getOtherProcesses()
Get the non-normal processes...


toString

public java.lang.String toString()

canBeSimulated

public boolean canBeSimulated()

canBeExternal

public boolean canBeExternal()

needsConnection

public boolean needsConnection()

isConnected

public boolean isConnected()

createGVectorObject

public RAGVectorObject createGVectorObject()
Create a GVectorObject.

Specified by:
createGVectorObject in interface RAGVectorObjectSource
Overrides:
createGVectorObject in class RAWorldObject